package com.iotechn.unimall.data.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.iotechn.unimall.data.domain.LogDO;
import com.iotechn.unimall.data.domain.ShopYanshouDO;
import com.iotechn.unimall.data.dto.goods.LogDTO;
import com.iotechn.unimall.data.dto.goods.YanshouDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by rize on 2019/7/2.
 */
public interface ShopYanshouMapper extends BaseMapper<ShopYanshouDO> {

    /**
     * 仅可传入叶子类目
     *
     * @param categoryId
     * @return
     */
    public List<ShopYanshouDO> getSpuTitleByCategoryId(Long categoryId);

    public List<YanshouDTO> getSpuDTOList(@Param("shopId") Long shopId, @Param("shopName") String shopName, @Param("type") Integer type, @Param("offset") Integer offset, @Param("limit") Integer limit);

    public Integer getSpuDTOListCount(@Param("shopId") Long shopId, @Param("shopName") String shopName,@Param("type") Integer type);

    /**
     * 增加Spu累计销量
     *
     * @param spuId
     * @param delta
     * @return
     */
    public Integer incSales(@Param("spuId") Long spuId, @Param("delta") Integer delta);

    public List<ShopYanshouDO> getSpuTitleAll();

    public List<ShopYanshouDO> search(String title);

}
